#include "Auxilliary.h"

#include <iostream>
#include "Exception.h"
using std::cerr;
using std::endl;

Auxilliary::Auxilliary(void)
{
}

Auxilliary::~Auxilliary(void)
{
}

void Auxilliary::toCharArray(string& str, unsigned int maxSize, char* buffer){
	if (str.length()<maxSize)
	{
		const char* src=str.c_str();
		for (unsigned int i=0;i<maxSize;i++)
		{
			if (i<str.length())
			{
				buffer[i]=src[i];
			}
			else
			{
				buffer[i]=0;
			}
		}
	}
	else
	{
		throw Exception("Auxilliary: cannot convert string to size specified.");
	}
}

//string* Auxilliary::toString(const char* arr, unsigned int maxSize){
//	return new string(arr,maxSize);
//}
